<!-- 无路由组件 -->
<template>
  <div class="index">
    <div v-for="route in routes" class="btn" @click="handleRoute(route)">
      {{ route.path }} 页面
    </div>
    <!-- <MyButton @handleClick="handleClick">测试远程组件库</MyButton> -->
  </div>
</template>

<script setup lang="ts">
// import routes from "~pages";
import router from "@/router/index";
import { RouteRecordRaw } from "vue-router";
const routes = router.options.routes;
const handleRoute = (route: RouteRecordRaw) => {
  console.log(routes, route, " route");
  const routePaths = route.path.split("/");
  routePaths.shift();
  if (routePaths.length === 1) {
    window.location.href = `${location.origin}/${routePaths[0]}/index.html#/`;
  } else {
    window.location.href = `${location.origin}/${routePaths[0]}/index.html#${route.path}`;
  }
};
const handleClick = () => {
  console.log("click");
};
</script>

<style lang="scss" scoped>
.index {
  padding: 40px;
  display: flex;
  flex-wrap: wrap;
}
.btn {
  font-size: 32px;
  color: #333;
  padding: 12px 20px;
  margin: 0 28px 30px 0;
  border: 1px solid #ddd;
  border-radius: 12px;
}
.preview-img-content-box {
  position: fixed;
  font-size: 0;
  line-height: 0;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  transition: all 0.3s;
  user-select: none;
  touch-action: none;
  opacity: 0;
  z-index: 2015;
}
.preview-img-content-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.08);
  pointer-events: none;
  z-index: 10;
}
.preview-img-content-box .preview-image {
  transform-origin: center center;
  transform: scale(0);
  /* transition: all 0.3s; */
  max-width: 90%;
  max-height: 90%;
  /* zoom: 3; */
  background-color: #fff;
}
.preview-img-content-box .preview-image.show-img {
  transform: scale(1);
}
.preview-img-content-box.show {
  opacity: 1;
}
</style>
